from common.base_model import BasicModelMixin, CompanyMixin, \
    CreateWithShortNameMixin, UpdateWithShortNameMixin, DeleteMixin
from exts import db
from common import constant


class Warehouse(BasicModelMixin, db.Model, CompanyMixin,
                CreateWithShortNameMixin, UpdateWithShortNameMixin,
                DeleteMixin):
    __tablename__ = 'warehouse'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(constant.MIDDLE_DB_STR_LEN), nullable=False)
    short_name = db.Column(db.String(constant.MIDDLE_DB_STR_LEN))

    __table_args__ = (
        db.UniqueConstraint('name', 'company_id'),
    )


